//
//  UserinfoViewController.m
//  penzer
//
//  Created by caiyc on 2018/9/18.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "UserinfoViewController.h"
#import "LoginViewController.h"
#import "RechargeViewController.h"
#import "OrderViewController.h"
#import "BackMoneyViewController.h"
#import "EditInfoViewController.h"
#import "CollectViewController.h"
#import "FouceHostViewController.h"
#import "EndLiveViewController.h"
#import "ChangeRoleViewController.h"
@interface UserinfoViewController ()
- (IBAction)checkOrder:(UIButton *)sender;
- (IBAction)chekback:(UIButton *)sender;

@end

@implementation UserinfoViewController
-(void)viewWillAppear:(BOOL)animated{
    if([XTool GetDefaultInfo:USER_INFO]){
        NSDictionary *userDic = [XTool GetDefaultInfo:USER_INFO];
        NSLog(@".......%@",userDic);
        NSURL *url = [NSURL URLWithString:userDic[@"avatar"]];
        [self.icon sd_setImageWithURL:url];
        self.nickName.text = [userDic[@"nickname"]isEqualToString:@""]?@"暂无":userDic[@"nickname"];
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setNavigation:1 andTitle:@"" andNaviColor:viewcontrollerColor andTitleColor:nil andRightimg:@"设置个人资料551" andsel:@selector(set)];
    self.botom_Scro.contentSize = CGSizeMake(screen_width, screen_height*1.2);
    self.botom_Scro.showsVerticalScrollIndicator = 0;
    self.rechage_Btn.layer.cornerRadius = 5;
    self.renwuNum.layer.cornerRadius = 10;
    self.renwuNum.layer.masksToBounds = 1;
    self.icon.layer.cornerRadius = 35;
    self.icon.layer.masksToBounds = 1;
    
    // Do any additional setup after loading the view from its nib.
}
-(void)set{
    //编辑个人信息
    EditInfoViewController *vc = [[EditInfoViewController alloc]init];
    [self pushSecondVC:vc];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)recharge:(id)sender {
    RechargeViewController *vc = [[RechargeViewController alloc]init];
    [self pushSecondVC:vc];
}

- (IBAction)exit:(id)sender {
    [[NSNotificationCenter defaultCenter]postNotificationName:STOPTIMENOTO object:nil];
    [XTool SaveDefaultInfo:nil Key:USER_INFO];
    [XTool SaveDefaultInfo:nil Key:Prole];
    LoginViewController *vc = [[LoginViewController alloc]init];
    [self pushSecondVC:vc];
}
//查看订单
- (IBAction)checkOrder:(UIButton *)sender {
    OrderViewController *vc = [[OrderViewController alloc]init];
    [self pushSecondVC:vc];
}


//查看退款
- (IBAction)chekback:(UIButton *)sender {
    BackMoneyViewController *vc = [[BackMoneyViewController alloc]init];
    [self pushSecondVC:vc];
}
//关注的主播
- (IBAction)fouce:(UIButton *)sender {
//    EndLiveViewController *vc = [[EndLiveViewController alloc]init];
//    [self pushSecondVC:vc];
    FouceHostViewController *vc = [[FouceHostViewController alloc]init];
    [self pushSecondVC:vc];
}
//收藏的直播间
- (IBAction)collect:(UIButton *)sender {
    CollectViewController *vc = [[CollectViewController alloc]init];
    [self pushSecondVC:vc];
}
//切换登录
- (IBAction)changerole:(UIButton *)sender {
    ChangeRoleViewController *vc = [[ChangeRoleViewController alloc]init];
    [self pushSecondVC:vc];
}
@end
